<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue中的插槽 slot</title>
    <script src="./vue.js"></script>
</head>
<body>
<div id="app">
    <body-content>
        <!--使用slot给插槽的内容起名字-->
        <div class="header" slot="header">header</div>
        <div class="footer" slot="footer">footer</div>
    </body-content>

    <!--使用默认值-->
    <body-content></body-content>
</div>
<script>
    Vue.component('body-content', {
        template: `<div>
                    <slot name="header"><h1>default header</h1></slot>
                    <div class="content">content</div>
                    <slot name="footer"><h1>default footer</h1></slot>
                   </div>`
    });
    var app = new Vue({
        el: '#app'
    });
</script>
</body>
</html>